﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Model
{

    [ObjectEvent]
    public class Features_GuideComponentEvent : ObjectEvent<Features_GuideComponent>, IAwake
    {
        public void Awake()
        {
            Get().Awake();
        }
    }

    public class Features_GuideComponent : BattleEventComponent
    {
        public override BattleEventType[] EventType { get; set; } = new BattleEventType[] {BattleEventType.AttackSuccess };

        public override async Task RunEvent(BattleEventType eventType, FightModel fightModel, params object[] param)
        {
            DamageInfo damageInfo = param[0] as DamageInfo;
            BattleCard battleCard = GetEntity<BattleCard>();
            if (battleCard == damageInfo.AttackCard)
            {
                DamageInfo d = new DamageInfo()
                {
                    AttackCard = battleCard,
                    DamageType = DamageTypeEnum.Special,
                    DamageValue = 1000,
                    Reciver = fightModel.GetDefencePlayer(),
                };
                fightModel.GetDefencePlayer().ChangeHp(d);
            }           
        }
    }
}
